<template>
	<view v-if="pageShow">
		<u-popup :show="show" @close="close">
			<view class="mainpadding dingwei">
				<view class="sanshier xiaohei fonweight textcenter margin_top">{{dataAll.name}}邀你加入会员</view>
				<view class="xiahuaxian">
					<view class="ershiba xiaohei nofonweight textcenter margin_top2">您将享受以下权益 </view>
				</view>
				<view class="ershil xiaohei nofonweight textcenter margin_top4">优先订场</view>
				<view class="ershil xiaohei nofonweight textcenter margin_top4">订场优惠</view>
				<view class="margin_top6 ">
					<view class="flexleft">
						<view class="xiaocon margin_right1"></view>
						<u-icon class="margin_right1" name="checkmark-circle-fill" color="#E3C385" size="18"></u-icon>
						<view class="strongtext xiaohei nofonweight textcenter">同意{{dataAll.name}}的会员规则</view>
					</view>
					<view class="huangbtnty margin_top2" @click="tzhyx">申请加入</view>
				</view>
				<image class="huiyuantb" src="../static/image/system/huiyuan.png" mode=""></image>
			</view>
		</u-popup>
		<!-- 场馆信息 -->
		<view class="dingwei">
			<image class="bannrcg" :src="dataAll.bg_image_text" mode=""></image>
			<!-- <view class="zyxxbox">
				<view class="xiaobai titletext fonweight">{{dataAll.name}}</view>
				<view class="xiaobai ershil nofonweight margin_top0">联系方式：{{dataAll.mobile}}</view>
				<view class="xiaobai ershil nofonweight margin_top0">联系地址：{{dataAll.cityinfo}}{{dataAll.address}}</view>
			</view> -->
		</view>
		<view class="" style="position: relative; top: -35rpx;padding-bottom: 150rpx;">
			<!-- 会员 -->
			<!-- <view class="mainpadding ffffff blockhy">
				<view class="dingwei">
					<image class="huiytu" src="../static/image/system/huiyk.png" mode=""></image>
					<view class="flexbetween huner" @click="show = true">
						<view class="xiaoka fonweight ershiba">会员卡</view>
						<view class="kabtn">申请加入会员</view>
					</view>
				</view>
			</view> -->
			<!-- 详细介绍 -->
			<view class="mainpadding ffffff margin_top1">
				<view class="xiaohei sanshier fonweight">{{dataAll.name}}</view>
				<view class="flexbetween" @click="callphone(dataAll.mobile)">
					<view class="xiaohei ershil nofonweight margin_top1">联系方式：{{dataAll.mobile}}</view>
					<u-icon name="phone-fill" color="#1BA95B"></u-icon>
				</view>
				<view class="flexbetween" @click="openmap()">
					<view class="xiaohei ershil nofonweight margin_top1">联系地址：{{dataAll.address}}
					</view>
					<u-icon name="map-fill" color="#1BA95B"></u-icon>
				</view>
				<view class="xiaohei fonweight sanshier margin_top4">详细介绍</view>
				<view class="nofonweight xiaohui margin_top1">{{dataAll.des}}</view>
				<!-- 教练展示 -->
				<view class="margin_top4">
					<view class="flexbetween" @click="tzcdjl">
						<view class="xiaohei fonweight sanshier">教练展示</view>
						<u-icon name="arrow-right"></u-icon>
					</view>
					<view class="flexleft flex_wrap">
						<view class="sanshis flexcenter margin_top" v-for="item in listjl" :key="item.id"
							@click="tzjlxq(item.jl_user_zbfapply_id)">
							<view class="">
								<view class="jiaolt">
									<image :src="item.zbfapply.logo_text" mode=""></image>
								</view>
								<view class="xiaohei titletext nofonweight margin_top2 textcenter">
									{{item.zbfapply.name}}</view>
							</view>
						</view>
					</view>
				</view>
				<view class="margin_top4">
					<view class="flexbetween" @click="tzsclb">
						<view class="sanshier fonweight xiaohei">散场列表</view>
						<u-icon name="arrow-right"></u-icon>
					</view>
					<view class="xiahuaxian margin_top" v-for="item in scList" :key="item.id" @click="tzscxq(item.id)">
						<view class="flexbetween">
							<view class="shilitu">
								<image :src="item.image_text" mode=""></image>
							</view>
							<view class="flexcolumnbet" style="width: 69%;height:160rpx">
								<view class="titletext xiaohei fonweight yhxk">{{item.name}}</view>
								<view class="flexleft margin_top2">
									<view class="sanshier xiaohong fonweight margin_right1">¥ {{item.price}}</view>
									<view class="titletext xiaohui zhonghuax">¥ {{item.price}}</view>
								</view>
							</view>
						</view>
					</view>
				</view>
				<view class="margin_top4">
					<view class="flexbetween" @click="tzgdkc">
						<view class="sanshier fonweight xiaohei">更多课程</view>
						<u-icon name="arrow-right"></u-icon>
					</view>
					<view class="xiahuaxian margin_top" v-for="item in kcList" :key="item.id" @click="tzkecxq(item.id)">
						<view class="flexbetween">
							<view class="shilitu">
								<image :src="item.image_text" mode=""></image>
							</view>
							<view class="" style="width: 69%;">
								<view class="titletext xiaohei fonweight yhxk">{{item.name}} </view>
								<view class="flexleft margin_top2">
									<view class="smalltext xiaohui nofonweight margin_right2">{{item.userzbfapply.name}}
									</view>
									<view class="line margin_right2"></view>
									<view class="smalltext xiaohui nofonweight yhxk">{{item.cityinfo}}
									</view>
								</view>
								<view class="flexbetween margin_top2">
									<view class="sanshier xiaohong fonweight">¥ {{item.priceinfo.price}}</view>
								</view>
							</view>
						</view>
					</view>
				</view>
				<!-- 场地设施 -->
				<view class="margin_top4" v-if="dataAll.bq_names_text.length">
					<view class="xiaohei fonweight sanshier">场地设施</view>
					<view class="flexleft flex_wrap">
						<view class="lvbtn margin_top2 margin_right1" v-for="(item,index) in dataAll.bq_names_text"
							:key="index">{{item}}</view>
					</view>
				</view>
				<!-- 温馨提示 -->
				<!-- <view class="margin_top4">
					<view class="xiaohei fonweight sanshier">温馨提示</view>
					<view class="nofonweight xiaohui margin_top2">
						1.请勿在运动场上吸烟,保持空气清新。2.运动前请做好热身准备,以免受伤。3.运动时请注意自己的身体状况,如有不适及时停止运动。4.禁止在运动场上飞车或者滑板等危险行为。</view>
				</view> -->
				<!-- 入场规则 -->
				<view class="margin_top4" v-if="dataAll.rc_gz">
					<view class="xiaohei fonweight sanshier">入场规则</view>
					<view class="nofonweight xiaohui margin_top2">{{dataAll.rc_gz}}</view>
				</view>
				<!-- 场馆视频 -->
				<view class="margin_top4" v-if="dataAll.video_text">
					<view class="xiaohei fonweight sanshier">场馆视频</view>
					<view class=" margin_top">
						<video :src="dataAll.video_text" object-fit="cover" style="width: 100%;height: 350rpx;"></video>
					</view>
				</view>
				<!-- 场馆图片 -->
				<view class="margin_top4" v-if="dataAll.images">
					<view class="xiaohei fonweight sanshier">场馆图片</view>
					<view class="margin_top2">
						<image class="cgtpiam" :src="item" mode="widthFix" v-for="(item,index) in dataAll.images_text"
							:key="index" @click="lbtpriview(index,dataAll.images_text)"></image>
					</view>
				</view>
			</view>
		</view>
		<view class="gudingdb mainpadding ffffff" @click="jumpdetail('/pages_homepage/xuanzechangci?id=',dataAll.id)">
			<view class="bigbtn">立即预定</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				show: false,
				dataAll: {},
				listid: "",
				pageShow: false,
				listjl: [],
				kcList: [],
				scList: []
			}
		},
		onLoad(options) {
			this.listid = options.id
			this.getDetail()
			this.getlistkc()
			this.getlistsc()
		},
		methods: {
			getlistsc() { //散场列表
				httpRequest.request('/api/cgcl/cgScIndex', 'GET', {
					page: 1,
					limit: 3,
					user_zbfapply_id: this.listid
				}, false, false, true).then(res => {
					this.scList = res.data.data
				})
			},
			getlistkc() { //更多课程
				httpRequest.request('/api/kccl/kcIndex', 'GET', {
					page: 1,
					limit: 3,
					is_rec: 2,
					user_zbfapply_id: this.listid
				}, false, false, true).then(res => {
					this.kcList = res.data.data
				})
			},
			// 跳转课程详情
			tzkecxq(id) {
				uni.navigateTo({
					url: '/pages_homepage/kechenggmxq?id=' + id
				})
			},
			// 跳转散场详情
			tzscxq(id) {
				uni.navigateTo({
					url: '/pages_homepage/sanchangxq?id=' + id
				})
			},
			// 跳转散场列表
			tzsclb(){
				uni.navigateTo({
					url: '/pages_homepage/sanchanglb?user_zbfapply_listid=' + this.listid
				})
			},
			// 跳转更多课程
			tzgdkc() {
				uni.navigateTo({
					url: '/pages_homepage/gengduokecheng?type=2&id=' + this.listid
				})
			},
			openmap() {
				uni.openLocation({
					latitude: Number(this.dataAll.latitude), //即将传到高德或腾讯地图的终点纬度  必须是数值，字符串无效
					longitude: Number(this.dataAll.longitude), //即将传到高德或腾讯地图的终点经度  必须是数值，字符串无效
					name: this.dataAll.name, //即将传到高德或腾讯地图的店铺名称
					address: this.dataAll.address, //即将传到高德或腾讯地图的详细地址
					scale: 18
				})
			},
			getDetail() {
				httpRequest.request('/api/user/jlbDetail', 'GET', {
					user_zbfapply_id: this.listid
				}, false, false, true).then(res => {
					this.dataAll = res.data
					if (res.data.type == 4) {
						this.init()
					}
					this.pageShow = true
				})
			},
			lbtpriview(index, arr) {
				var i = arr; //获取当前页面的轮播图数据
				//uniapp预览轮播图
				uni.previewImage({
					current: index, //预览图片的下标
					urls: i //预览图片的地址，必须要数组形式，如果不是数组形式就转换成数组形式就可以
				})
			},
			init() {
				let _this = this;
				let data = {
					page: 1,
					limit: 12,
					user_zbfapply_id: this.listid
				}
				let url = '/api/user/cgJlList'
				httpRequest.request(url, 'GET', data, false, false, true).then(res => {
					if (res.code == 1) {
						this.listjl = res.data.data;
					}
				})
			},
			// 跳转场地教练
			tzcdjl() {
				if (!httpRequest.checkIsLogin()) {
					uni.navigateTo({
						url: "/pages/login/login"
					})
					return false
				}
				uni.navigateTo({
					url: '/pages_homepage/changdijiaol?id=' + this.listid
				})
			},
			jumpdetail(url, id) {
				if (!httpRequest.checkIsLogin()) {
					uni.navigateTo({
						url: "/pages/login/login"
					})
					return false
				}
				uni.navigateTo({
					url: url + id
				})
			},
			// 跳转教练详情
			tzjlxq(id) {
				if (!httpRequest.checkIsLogin()) {
					uni.navigateTo({
						url: "/pages/login/login"
					})
					return false
				}
				uni.navigateTo({
					url: '/pages_homepage/jiaolianxq?id=' + id
				})
			},
			// 跳转会员中心
			tzhyx() {
				if (!httpRequest.checkIsLogin()) {
					uni.navigateTo({
						url: "/pages/login/login"
					})
					return false
				}
				uni.navigateTo({
					url: '/pages_homepage/huiyuanzx'
				})
			},
			close() {
				this.show = false
				// console.log('close');
			}
		}
	}
</script>

<style lang="scss" scoped>
	.shilitu {
		width: 200rpx;
		height: 160rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.lvbtn {
		background: #DFFFED;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		padding: 6rpx 10rpx;
		font-size: 20rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #1BA95B;
	}

	.huiyuantb {
		width: 132rpx;
		height: 132rpx;
		position: absolute;
		top: -84rpx;
		left: 310rpx;
	}

	.xiaocon {
		width: 24rpx;
		height: 24rpx;
		background: #FFFFFF;
		border-radius: 50%;
		border: 2rpx solid #AAAAAA;
	}

	.menlc {
		height: 360rpx;
		width: 100%;
		position: absolute;
		bottom: 6rpx;
		left: 0;
		border-radius: 16rpx;
		background-color: hsla(0, 0%, 0%, .3);
	}

	.fudsp {
		position: absolute;
		bottom: 140rpx;
		left: 304rpx;
		width: 80rpx;
		height: 80rpx;
	}

	.cgtpiam {
		height: 360rpx;
		width: 100%;
		border-radius: 16rpx;
	}

	.jiaolt {
		width: 210rpx;
		height: 210rpx;

		image {
			border-radius: 10rpx;
			width: 100%;
			height: 100%;
		}
	}

	.huner {
		position: absolute;
		bottom: 30rpx;
		right: 30rpx;
		width: 90%;
	}

	.kabtn {
		padding: 6rpx 20rpx 8rpx;
		background-color: #6A4B18;
		font-size: 24rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		border-radius: 30rpx;
	}

	.huiytu {
		height: 100rpx;
		width: 100%;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.blockhy {
		border-radius: 20rpx 20rpx 0rpx 0rpx;
	}

	page {
		background-color: #F9F9F9;
	}

	.zyxxbox {
		position: absolute;
		bottom: 60rpx;
		left: 30rpx;
	}
</style>